package com.st.buy.manager.controller;

import com.st.buy.util.pojo.BuyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

/**
 * @author 张双虎
 * 索引库管理
 */
@Controller
public class SearchController {
    @Autowired
    private RestTemplate restTemplate;
    @Value("${searchService}")
    private String searchService;

    @RequestMapping("/index/item/import")
    @ResponseBody
    public BuyResult importIndex(){
        return restTemplate.getForObject("http://"+searchService+"/search/importIndex",BuyResult.class);
    }
}
